// pages/jinglaoyuan/jinglaoyuan.js
var app = getApp()
var ConstantData = require('../../../common/constant_data.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {
    cardList: [],
    cardnumber: '',
    phoneNumber: '',
    phone: '',
    img:{
        jinglaoka: ConstantData.CONSTATNT_DATA.imgJingLaoKa
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options, 'optionsssss')
    var that = this
    that.setData({
      phoneNumber: options.phoneNumber ? options.phoneNumber : '',
      isUser: options.isUser ? options.isUser : '',
      cardnumber: options.card ? options.card : '',
      address: options.address ? options.address : '',
      cardFee: options.cardfee ? options.cardfee : '',
      hotline: options.hotline ? options.hotline : '',
      balance: options.balance ? options.balance : '',
      phone: options.phone ? options.phone : '',
      canViewUseRecord: options.canViewUseRecord? options.canViewUseRecord:'',
      cardOwner:options.cardOwner?options.cardOwner:'',
      userName:options.userName?options.userName:'',
      memo:options.memo?options.memo:'',
    })
    console.log(that.data.isUser, 'that.data.isUser')
    // 卡列表
  },
  jumprefund() {
    wx.navigateTo({
      url: '../refund/refund?card=' + this.data.cardnumber + '&isUser=' + this.data.isUser,
    })
  },
  callPhone(e) {
    console.log(e.currentTarget.dataset.hotline)
    wx.makePhoneCall({
      phoneNumber: e.currentTarget.dataset.hotline //仅为示例，并非真实的电话号码
    })
  },
  jumpcardDetail() {
    wx.navigateTo({
      url: '../cardDetail/cardDetail?card=' + this.data.cardnumber + '&isUser=' + this.data.isUser,
    })
  },
  jumpSelectLease() {
    wx.navigateTo({
      url: '../selectLease/selectLease?card=' + this.data.cardnumber +'&memo='+this.data.memo +'&userName='+this.data.userName +'&cardOwner='+this.data.cardOwner,
    })
  },
  jumpCashPledgeHistory() {
    wx.navigateTo({
      url: '../cashPledgeHistory/cashPledgeHistory?card=' + this.data.cardnumber,
    })
  },
  jumpICusageRecord() {
    wx.navigateTo({
      url: '../ICusageRecord/ICusageRecord?card=' + this.data.cardnumber,
    })
  },
  jumpRefundHistory() {
    wx.navigateTo({
      url: '../refundHistory/refundHistory?card=' + this.data.cardnumber,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this
    if (that.data.balance != '0') {
      that.setData({
        vShow: true
      })
    } else {
      that.setData({
        vShow: false
      })
    }

  },
  callBackCard() {
    wx.makePhoneCall({
      phoneNumber: this.data.hotline //仅为示例，并非真实的电话号码
    })
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})